﻿package com.wandian.controller
{
	import com.wandian.data.GameData;
	import com.wandian.model.AccountProxy;
	import com.wandian.model.ShopProxy;
	import com.wandian.model.socket.ServerPacketProxy;
	import com.wandian.model.vo.PlayerVo;
	import com.wandian.model.vo.RoomVo;
	import com.wandian.view.mediator.GameRoomMediator;
	import com.wandian.view.mediator.MaskGameMediator;
	import com.wandian.view.mediator.account.AccountMediator;
	import com.wandian.view.mediator.bank.BankMediator;
	import com.wandian.view.mediator.shop.ShopMediator;
	
	import flash.display.MovieClip;
	
	import org.puremvc.as3.interfaces.*;
	import org.puremvc.as3.patterns.command.*;

    public class ShopCommand extends SimpleCommand
    {
        private var _global:GameData;
        private var shopPanel:MovieClip;

        public function ShopCommand()
        {
            this._global = GameData.getInstance();
            return;
        }

        override public function execute(notification:INotification) : void
        {
            super.execute(notification);
            var _loc_2:* = facade.retrieveProxy(ShopProxy.NAME) as ShopProxy;
            var _loc_3:* = notification.getBody() as PlayerVo;
            switch(notification.getName())
            {
                case CLZNoticeName.SHOW_SHOPING_HOT_PROP:
                {
                    this.showShop(_loc_3, GameData.SHOP_HOTPROP_TYPE);
                    break;
                }
                case CLZNoticeName.SHOW_SHOPING_GIFT:
                {
                    this.showShop(_loc_3, GameData.SHOP_GIFT_TYPE);
                    break;
                }
                case CLZNoticeName.SHOW_SHOPING_VIP:
                {
                    this.showShop(_loc_3, GameData.SHOP_VIP_TYPE);
                    break;
                }
                case CLZNoticeName.SHOW_SHOPING_INTERACTIVE_PROP:
                {
                    this.showShop(_loc_3, GameData.SHOP_INTERACTIVEPROP_TYPE);
                    break;
                }
                case CLZNoticeName.SHOP_HOT_PROP_LIST_REQ:
                {
                    _loc_2.requestHotPropList();
                    break;
                }
                case CLZNoticeName.SHOP_INTERACTIVE_PROP_LIST_REQ:
                {
                    _loc_2.requestInteractivePropList();
                    break;
                }
                case CLZNoticeName.SHOP_GIFT_LIST_REQ:
                {
                    _loc_2.requestGiftList(int(notification.getBody()));
                    break;
                }
                case CLZNoticeName.SHOP_VIP_LIST_REQ:
                {
                    _loc_2.requestVipList();
                    break;
                }
                default:
                {
                    break;
                }
            }
            return;
        }

        private function showShop(param1:PlayerVo, param2:int) : void
        {
            if (!this.shopPanel)
            {
                this.shopPanel = GameData.getMovieClip("ShopMainPanel");
            }
            if (!Texas.I._mcWindosView.contains(this.shopPanel))
            {
                Texas.I._mcWindosView.addChildTo(this.shopPanel);
                Texas.I._mcWindosView.centerXY(this.shopPanel, 0, 7);
            }
            facade.registerMediator(new ShopMediator(this.shopPanel, param2, param1));
            return;
        }

    }
}
